class Solution
{
public:
    bool findTargetIn2DPlants(vector<vector<int>>& plants, int target)
    {
        if (plants.empty()) return false;
        int m = plants.size(), n = plants[0].size();
        int i = 0, j = n - 1;
        while (i < m && j >= 0)
        {
            if (plants[i][j] == target) return true;
            if (plants[i][j] < target) i++;
            else j--;
        }
        return false;
    }
};